<?php


/**
* Puree CMS
* http://www.molotsoft.ru
*
* @package Puree_CMS
* @subpackage Admin/Elements
* @author Ivan Chistyakov <ivan@molotsoft.ru>
* @version $Id: admin_index_filter.ctp 1547 2010-04-28 07:41:08Z molotsoft@gmail.com $
* @link $HeadURL: http://puree-cms.googlecode.com/svn/trunk/plugins/admin/views/elements/automate/admin_index_filter.ctp $
*/


// list_filter
echo '<div class="list_filter" style="display: ' . ($session->check('AdminFilter.' . $model) ? 'block' : 'none') . ';">';

// form_container
echo '<div class="form form_container">';
if (isset($is_tree, $parent_id) && $is_tree) {
	$filter_url = array('action' => 'filter', $parent_id, 'autoPage' => TRUE);
} elseif (isset($has_rubric, $rubric_id) && $has_rubric) {
	$filter_url = array('action' => 'filter', $rubric_id, 'autoPage' => FALSE);
} else {
	$filter_url = array('action' => 'filter', 'autoPage' => FALSE);
}
echo $form->create($model, array('id' => 'filter', 'url' => $filter_url));

// form_content
echo '<div class="form_content">';
echo $form->input($display_field, array('label' => $field_schema[$display_field]['input']['label'], 'type' => 'text', 'value' => $session->read('AdminFilter.' . $model . '.' . $display_field), 'div' => 'form_field form_field_text'));
$no_yes_options = array(__('no_label', TRUE), __('yes_label', TRUE));
foreach ($field_schema as $field_name => $field_description) {
	if ($field_description['input']['type'] === 'checkbox') {
		echo $form->input($field_name, array('label' => $field_description['input']['label'], 'type' => 'select', 'options' => $no_yes_options, 'selected' => $session->read('AdminFilter.' . $model . '.' . $field_name), 'empty' => TRUE, 'div' => 'form_field form_field_select'));
	}
}
if (isset($field_schema['created'], $field_schema['modified'])) {
	echo $form->input('x-new-row', array('label' => __('new_row_field', TRUE), 'type' => 'select', 'options' => $no_yes_options, 'selected' => $session->read('AdminFilter.' . $model . '.x-new-row'), 'empty' => TRUE, 'div' => 'form_field form_field_select'));
}
echo '</div>'; // end of form_content

// form_buttons
echo '<div class="form_buttons">';
// form_button_filter
echo '<div class="form_button form_button_filter">' . $routine->buttonSubmitClose('find', __('filter_action', TRUE)) . '</div>';
echo '</div>'; // end of form_buttons

echo $form->end();
echo '</div>'; // end of form_container

echo '</div>'; // end of list_filter


?>